<?php


namespace app\common\model;


class BannerModel extends CommonModel
{
    protected $name = 'banner';

    public function getIsCarouselAttr($v): bool
    {
        return $v === 1;
    }

    public function getBannerListPaginate($where = [], $page = 1, $limit = 10): \think\Paginator
    {
        return $this->with([])->order([
            'create_time' => 'desc',
        ])->where($where)->paginate([
            'page'      => $page,
            'list_rows' => $limit,
        ]);
    }

    public function getBannerList($where = []): \think\Collection
    {
        return $this->with([])->order([
            'create_time' => 'desc',
        ])->select();
    }
}